package com.zoro.barn.business.service.system.business.rolemenu.controller;

import com.zoro.barn.business.service.system.business.rolemenu.entity.BarnRoleMenu;
import com.zoro.barn.business.service.system.business.rolemenu.service.BarnRoleMenuService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhaoxingwu
 */
@RestController
@RequestMapping("/role-menu")
public class BarnRoleMenuController {

    private final BarnRoleMenuService barnRoleMenuService;

    public BarnRoleMenuController(BarnRoleMenuService barnRoleMenuService) {
        this.barnRoleMenuService = barnRoleMenuService;
    }

    /**
     * 添加
     *
     * @param roleMenu new data
     */
    @RequestMapping("/add")
    public void add(@RequestBody BarnRoleMenu roleMenu) {
        this.barnRoleMenuService.add(roleMenu.getRoleId(), roleMenu.getMenuId());
    }

    /**
     * 删除
     *
     * @param roleMenu data
     */
    @RequestMapping("/delete")
    public void delete(@RequestBody BarnRoleMenu roleMenu) {
        this.barnRoleMenuService.delete(roleMenu.getRoleId(), roleMenu.getMenuId());
    }
}
